package com.qiuhui.controller;

import com.sun.org.apache.xpath.internal.operations.Mod;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * @ClassName: RestFulController
 * @Description: TODO
 * @author: tian
 * @date: 2021/3/22  4:06 下午
 */
@Controller
public class RestFulController {
    @RequestMapping("/commit/{a}/{b}")
    public String add(@PathVariable int a, @PathVariable int b, Model model) {
        int result = a + b;
        model.addAttribute("msg", result);
        return "user";
    }

    @RequestMapping(value = "/user", method = {RequestMethod.GET})
    public String getUser(Model model) {
        model.addAttribute("msg", "Request Method");
        return "user";
    }
}
